/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Monsters;

import Inrterface.Messages;
import Map.Map;
import Map.MapConfig;
import Map.MapLevel;
import Map.MapUtils;
import Tactics.*;
import java.io.FileNotFoundException;
import java.io.IOException;
import jcgame.Main;

/**
 *
 * @author insane
 */
public class Monster {

    private boolean sex;
    private int speed;
    private int x = 10;
    private int y = 10;
    private char view = 'm';
    private int level;
    private int color;
    private String name =null;
    private int minDamage = 0;
    private int maxDamage = 0;
    private int live;

    public Monster(boolean sex, int speed, int x, int y, int lv) {
        this.x = x;
        this.y = y;
        this.sex = sex;
        this.speed = speed;
        this.live = lv;
    }
    public Monster(boolean sex, int speed, int x, int y, int mindam, int maxdam, int lv) {
        this.x = x;
        this.y = y;
        this.sex = sex;
        this.speed = speed;
        this.maxDamage = maxdam;
        this.minDamage = mindam;
        this.live = lv;
    }

    /**
     * @return the sex
     */
    public boolean isSex() {
        return sex;
    }

    /**
     * @param sex the sex to set
     */
    public void setSex(boolean sex) {
        this.sex = sex;
    }

    /**
     * @return the speed
     */
    public int getSpeed() {
        return speed;
    }

    /**
     * @param speed the speed to set
     */
    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public void analize() throws FileNotFoundException, IOException, ClassNotFoundException {
        tactics();
    }

    private void tactics() throws FileNotFoundException, IOException, ClassNotFoundException {
        Movement.getInstance().action(this);
        //Attack.getInstance().action(this);
    }

    /**
     * @return the x
     */
    public int getX() {
        return x;
    }

    /**
     * @param x the x to set
     */
    public void setX(int x) {
        this.x = x;
    }

    /**
     * @return the y
     */
    public int getY() {
        return y;
    }

    /**
     * @param y the y to set
     */
    public void setY(int y) {
        this.y = y;
    }

    public void draw() throws FileNotFoundException, IOException, ClassNotFoundException {
        int[] position = MapUtils.ViewToScreen(x, y, MapLevel.getInstance().getMap());

        if (position != null && MapUtils.checkFovVisible(position[0],position[1])) {
                //) {
            Main.csi.print(
                    position[0] + MapConfig.getInstance().getPadding_left(),
                    position[1] + MapConfig.getInstance().getPadding_top(), getView(),
                    MapUtils.getColor(color));

            //Messages.getInstance().add(this.name + ": " + this.x + "-" + this.y);

        }


    }

    /**
     * @return the level
     */
    public int getLevel() {
        return level;
    }

    /**
     * @param level the level to set
     */
    public void setLevel(int level) {
        this.level = level;
    }

    /**
     * @return the color
     */
    public int getColor() {
        return color;
    }

    /**
     * @param color the color to set
     */
    public void setColor(int color) {
        this.color = color;
    }

    /**
     * @return the view
     */
    public char getView() {
        return view;
    }

    /**
     * @param view the view to set
     */
    public void setView(char view) {
        this.view = view;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the minDamage
     */
    public int getMinDamage() {
        return minDamage;
    }

    /**
     * @param minDamage the minDamage to set
     */
    public void setMinDamage(int minDamage) {
        this.minDamage = minDamage;
    }

    /**
     * @return the maxDamage
     */
    public int getMaxDamage() {
        return maxDamage;
    }

    /**
     * @param maxDamage the maxDamage to set
     */
    public void setMaxDamage(int maxDamage) {
        this.maxDamage = maxDamage;
    }

    /**
     * @return the live
     */
    public int getLive() {
        return live;
    }

    /**
     * @param live the live to set
     */
    public void setLive(int live) {
        this.live = live;
    }
}
